# -*- coding: utf-8 -*-
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

from models import Vocabulary, PublicBook
from controls import setting

class BookManagementPage(webapp.RequestHandler):
    def get(self):
        query = Vocabulary.all()
        public_books = PublicBook.all().fetch(1000)
        words = query.fetch(10)
        pagename = 'bookmanagement'
        template_values = {
            'style_file_name' : pagename + '.css',
            'words': words,
            'public_books' : public_books
            }
        template_values.update(setting.common_template_values(self.request.uri))
        #voc = Vocabulary(word="abandon",pronunciation="[&#601;'b&aelig;nd&#601;n]")
        #voc.put()
        template_name = setting.get_template_name(pagename + '.html')
        self.response.out.write(template.render(template_name, template_values))
